package com.itheima.demo;

import java.util.Scanner;

/**
 * @author jiangxun
 * @date 11-20-2024
 */
public class Test {
    public static void main(String[] args) {
        ElectricAppliance[] appliances = new ElectricAppliance[4];
        appliances[0] = new Light("电灯", true);
        appliances[1] = new Light("电灯", false);
        appliances[2] = new Air("空调", false);
        appliances[3] = new Air("空调", true);

        SmartHomeControl control = new SmartHomeControl();
//        control.control(appliances[0]);
        while(true){
            control.printAllStatus(appliances);
            System.out.println("请您选择要控制的设备：");
            Scanner sc= new Scanner(System.in);
            String command=sc.next();
            switch (command){
                case "1":
                    control.control(appliances[0]);
                    break;
                case "2":
                    control.control(appliances[1]);
                    break;
                case "3":
                    control.control(appliances[2]);
                    break;
                case "4":
                    control.control(appliances[3]);
                    break;
                case "Y":
                    System.out.println("退出App！");
                    return;
                default:
                    System.out.println("您的输入有误，请重新输入");
                    break;
            }
        }

    }
}
